<!--
 * @Description:
 * @Autor: Song
 * @Date: 2023-02-07 11:07:01
 * @LastEditors: Song
 * @LastEditTime: 2023-02-07 17:40:03
-->
<template>
	<div class="echarts" :id="id"></div>
</template>
<script setup lang="ts" name="pie">
// import { onMounted, reactive, ref, watch } from "vue";
import { ECharts, init } from "echarts";
// 接收父组件参数，并设置默认值
interface RichEditorProps {
	id: string;
}
const props = defineProps<RichEditorProps>();
const initChart = (data: any): ECharts => {
	const echarts: ECharts = init(document.getElementById(props.id) as HTMLElement);
	echarts.setOption(data, true);
	return echarts;
};
defineExpose({
	initChart
});
</script>

<style lang="scss" scoped>
.echarts {
	width: 100%;
	height: 400px;
}
</style>
